//
//  ProductModel.m
//  NekaPrice
//
//  Created by yu on 2018/6/14.
//  Copyright © 2018年 ma c. All rights reserved.
//

#import "ProductModel.h"

@implementation ProductModel

- (instancetype)initWithInitalRowCount:(NSInteger)count {
    if (self = [super init]) {
        _initalRowCount = count;
    }
    return self;
}

- (void)setCarBrandModel:(CarModel *)carBrandModel {
    if (_carBrandModel == nil || ![_carBrandModel.cat_id isEqualToString:carBrandModel.cat_id]) {
        _carBrandModel = carBrandModel;
    }
}

- (void)setCarSeriesModel:(CarModel *)carSeriesModel {
    if (_carSeriesModel == nil || ![_carSeriesModel.cat_id isEqualToString:carSeriesModel.cat_id]) {
        _carSeriesModel = carSeriesModel;
    }
}

- (void)setCarProductModel:(ProjectModel *)carProductModel {
    if (_carProductModel == nil || ![_carProductModel.pro_id isEqualToString:carProductModel.pro_id]) {
        _carProductModel = carProductModel;
    }
}

- (void)setGlaPartModel:(ProjectModel *)glaPartModel {
    if (_glaPartModel == nil || ![_glaPartModel.gla_id isEqualToString:glaPartModel.gla_id]) {
        _glaPartModel = glaPartModel;
    }
}

- (void)setGlaProductModel:(ProjectModel *)glaProductModel {
    if (_glaProductModel == nil || ![_glaProductModel.gla_id isEqualToString:glaProductModel.gla_id]) {
        _glaProductModel = glaProductModel;
    }
}


- (NSString *)carBrandName {
    return self.carBrandModel == nil ? @"请选择爱车品牌" : self.carBrandModel.cat_name;
}


- (NSString *)carSeriesName {
    return self.carSeriesModel == nil ? @"请选择具体车型" : self.carSeriesModel.cat_name;
}


- (NSString *)carProductName {
    return self.carProductModel == nil ? @"请选择项目" : self.carProductModel.pro_name;
}

- (NSString *)glaPartName {
    return self.glaPartModel == nil ? @"选择套餐" : self.glaPartModel.gla_name;
}

- (NSString *)glaProductName {
    return self.glaProductModel == nil ? @"选择隔热膜" : self.glaProductModel.gla_name;
}


- (NSInteger)rowCount {
    CGFloat count = _initalRowCount;
    if (_price.length > 0) {
        count += 3;
    }
    return count;
}


@end
